package com.panshi.service.impl;

import com.panshi.dao.IUserDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.panshi.service.*;
import com.panshi.bean.*;


import java.util.List;

/**
 * @ Author     ：周飞帆
 * @ Date        ：2020/8/2 0002 19:16
 * @ClassName : UserServiceImpl
 * @Version: 1.0$
 */
@Slf4j
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserDao userDao;

    @Override
    @Cacheable(value = "hasbei:user", key = "#id")
    public List<User> queryUser(int id) {
        List<User> userList = userDao.queryUser(id);
        log.info("查询用户个人资料={}", userList);
        return userList;
    }

    @Override
    @CacheEvict(value = "hasbei:user", key = "#id")
    public void reviseUser(int id, User user) {
        log.info("修改用户个人资料={}", user);
    }

}
